﻿using System;

namespace IdeaNMR.Shared
{
    public class ParameterNotFoundException : ParameterException
    {
        public ParameterNotFoundException(string message, string parameterName, string sourceFunction)
            : base(message, parameterName, sourceFunction)
        { }
    }

    public class ParameterNullException : ParameterException
    {
        public ParameterNullException(string message, string sourceFunction)
            : base(message, null, sourceFunction)
        { }

        public ParameterNullException()
            : base("SetupScope: parameter is null.")
        { }
    }

    public class ParameterException : ApplicationException
    {
        public string ParameterName
        {
            get { return _parametername; }
        }

        public string SourceFunctionName
        {
            get { return _sourceFunction; }
        }

        public ParameterException(string message, string parameterName, string sourceFunction)
            : base (message)
        {
            _parametername = parameterName;
            _sourceFunction = sourceFunction;
        }

        public ParameterException(string message, string parameterName)
            : base(message)
        {
            _parametername = parameterName;
        }

        private string _parametername;
        private string _sourceFunction;

        #region Inherited Constructors
        public ParameterException()
            : base("Setup Scope Bad Parameter exception")
        { }
        public ParameterException(string message)
            : base(message)
        { }
        public ParameterException(string message, System.Exception innerException)
            : base(message, innerException)
        { }

        protected ParameterException(System.Runtime.Serialization.SerializationInfo info,
        System.Runtime.Serialization.StreamingContext context)
            : base(info, context)
        { }
        #endregion
    }
}
